import React from 'react';
import PropTypes from 'prop-types';
import { Input } from 'antd';
import BaseDialog from '../../../../controls/BaseDialog';
import AutoForm from '../../../../controls/AutoForm';
import Const from '../../../../common/const';
import { InputNumber } from 'antd';

const { TextArea } = Input;


export default class EditMaterialDialog extends BaseDialog {

    getModalProps() {
        return {
            title: '编辑素材'
        };
    }

    renderContent(data) {
        return <AutoForm
            ref={e => this.form = e}
            layout="horizontal"
            itemProps={{
                labelCol: { span: 4 },
                wrapperCol: { span: 20 },
            }}
            items={[
                {
                    label: '素材地址',
                    initialValue: data.src,
                    name: 'src',
                    content: <TextArea disabled={true} style={{ resize: 'none' }} />
                },
                {
                    name: 'tileWidth',
                    label: '图块宽度',
                    initialValue: data.tileWidth || Const.TileWidth,
                    content: <InputNumber max={1024} min={1} />
                },
                {
                    name: 'tileHeight',
                    label: '图块高度',
                    initialValue: data.tileHeight || Const.TileHeight,
                    content: <InputNumber max={1024} min={0} />
                }
            ]} />;
    }
}